﻿using System;
using System.Collections.Generic;
using System.Linq;
using Risk.Services;

namespace Site.Models
{
    public class OpenGamesDTO
    {
        public String Username { get; set; }
        public OpenGamesDTO(string username)
        {
            Username = username;
        }
        public List<GameDTO> Games
        {
            get { return DatabaseManager.GetOpenGameIds().Select(gameId => new GameDTO(gameId)).ToList(); }
        }
        public bool IsPlayerCreatorOfGame(int gameId)
        {
            return DatabaseManager.IsCreatorOfGame(Username, gameId);
        }
    }
}